import log from '@dfeidao/atom-nodejs/logger/log';
import { IncomingHttpHeaders } from 'http';
import { systemid, productid } from '../../atom/config';
import operate from '@dfeidao/atom-nodejs/db/operate';
interface Message {
	_id: string[]
}

// interface IWebResult {
// 	data: unknown;
// 	cookie?: {
// 		[name: string]: string;
// 	} | null;
// 	content_type?: string;
// 	headers?: {
// 		[key: string]: string[];
// 	};
// 	attachment?: string;
// 	redirect?: string;
// 	status_code?: number;
// }

export default async function atom(message: Message, action_id: string, session_id: string, headers: IncomingHttpHeaders) {
	const { del, exec } = operate(action_id, session_id, systemid);
	del('asso_job', { productid, _id: { $in: message._id } });
	const r = await exec();
	return {
		data: r
	}
}
